<?
/*********************************************
*说明页列表
* *******************************************/
function smarty_function_qishi_explain_list($params, &$smarty)
{ 
extract($params);
global $db;
$row = (NULL != $row) ? $row : 15; //默认显示记录数量
$titlelen = (NULL != $titlelen) ? $titlelen : 15; //默认标题长度
$start  = (NULL != $start) ? $start : 0; //从第几条开始读取，缺省0
$dot = (NULL != $dot) ? $dot : ''; //默认截取后填补字符
$listname = (NULL != $listname) ? $listname : "list"; //默认的section名称
$settr = (NULL != $settr) ? $settr : ""; //时间范围
$wheresql=" WHERE is_display='1' ";
$typeid?$wheresql.=" AND  type_id='".intval($typeid)."' ":'';//栏目ID
	if (intval($settr))
	{
	$settr_val=strtotime("-".$settr." day");
	$wheresql.=" AND addtime > ".$settr_val;
	}
//排列字段
$orderby=ereg('show_order|id|addtime',$orderby)?$orderby:"show_order";
//显示顺序
$displayorder=ereg('asc|desc',$displayorder)?$displayorder:"DESC";
//sql语句
$orderbysql=" ORDER BY ".$orderby." ".$displayorder;
if(!empty($row))
{
$start=$start?$start:0;
$limit=" LIMIT ".$start.','.$row;
}
$result = $db->query("SELECT * FROM ".table('explain')." ".$wheresql.$orderbysql.$limit);
while($row = $db->fetch_array($result))
{
$style_color=$row['tit_color']?"color:".$row['tit_color'].";":'';
$style_font=$row['tit_b']=="1"?"font-weight:bold;":'';
$row['title']=cut_str($row['title'],$titlelen,0,$dot);
if ($style_color || $style_font)$row['title']="<span style=".$style_color.$style_font.">".$row['title']."</span>";
$row['url'] =$row['is_url']<>"http://"?$row['is_url']:url_rewrite('explain-show',array('id0'=>$row['id']));
$row['content']=html2text($row['content']);
$row['content']=cut_str($row['content'],$infolen,0,$dot);
$List[] = $row;
}
$smarty->assign($listname, $List);
unset($List);
}
?>